<?php
namespace Home\Model;
use Think\Model;
/**
* 红包控制器
*/
class RedMoneyModel extends CommonModel{
	//获得见面礼红包
	public function getGift($id,$user_id,$money){
		$jian_red = array(
			'activity_id'=> $id,
			'user_id' => $user_id,
			'money'	  => $money,
			'type'	  => 2,
			'status'  => 1,
			'content' => '见面礼红包',
			'add_time'=> time(),
			'get_time'=> (time() + 24*3600)
		);
		M('red_money')->add($jian_red);
	}

	public function addRedMoney($activity_id,$user_id,$money,$start_time){
		//间隔时间
		$interval = 24*3600;
		//红包数据
		$data = array(
			'activity_id'=> $activity_id,
			'user_id' => $user_id,
			'money'	  => $money,
			'type'	  => 1,
			'status'  => 1,
			'add_time'=> time(),
			'get_time'=> $start_time + $interval,
		);
		$res = M('red_money')->add($data);
		return $res ? $res : false;
	}
}